package Test2;
class Student{
    public  String name;

    public Student(String name) {
        this.name = name;
    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' + '}';
    }

    @Override
    public boolean equals(Object obj) {
        Student student = (Student) obj;
        if(this.name.equals(((Student) obj).name))
            return true;
            else
                return false;
    }
}
public class Test1 {
    public static void main(String[] args) {
        Student[] students = new Student[3];
        students[0] = new Student("李四");
        students[1] = new Student("李四");
        System.out.println(students[0].equals(students[1]));
    }
}
